﻿package mortal.game.scene3D.player.entity
{
    import Message.BroadCast.*;
    import Message.DB.Tables.*;
    import Message.Public.*;
    import baseEngine.core.*;
    import baseEngine.modifiers.*;
    import baseEngine.system.*;
    import com.greensock.*;
    import extend.language.*;
    import flash.events.*;
    import frEngine.*;
    import frEngine.core.*;
    import frEngine.effectEditTool.temple.*;
    import frEngine.event.*;
    import frEngine.pools.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.display3d.blood.*;
    import mortal.game.scene3D.fight.*;
    import mortal.game.scene3D.layer3D.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.*;
    import mortal.game.scene3D.map3D.AstarAnyDirection.data.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.model.data.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.player.weapon.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.scene3D.player.type.*;
    import mortal.game.scene3D.swf3D.*;
    import mortal.game.utils.*;
    import mortal.game.view.palyer.data.*;
    import mortal.game.view.platform.*;
    import mortal.game.view.systemSetting.*;

    public class UserPlayer extends MovePlayer
    {
        protected var _clothHangEffect:EffectPlayer;
        protected var _hairPlayer:ActionPlayer;
        protected var _wingPlayer:ActionPlayer;
        protected var _wingHangEffect:EffectPlayer;
        protected var _weaponPlayer:WeaponPlayer;
        protected var _weaponHangEffect:EffectPlayer;
        protected var _mountPlayer:ActionPlayer;
        protected var _mountHangEffect:EffectPlayer;
        protected var _wizardSmallPlayer:WizardSmallPlayer;
        protected var _zazenEffectPlayer:EffectPlayer;
        protected var _sunbathCopyPlayMusical:EffectPlayer;
        protected var _mainCityPlayer:ActionPlayer;
        protected var _mainCityEffectPlayer:EffectPlayer;
        protected const swinCloth:int = 130130;
        private var swf:Swf3DPlayer;
        protected var _tweenY:TweenLite;
        private var _petEntityID:SEntityId;
        protected var _swinEffect:EffectPlayer;
        protected var _currentUrl:String = "";

        public function UserPlayer()
        {
            overPriority = Game2DOverPriority.Use;
            this._petEntityID = new SEntityId();
            return;
        }// end function

        public function get weaponPlayer() : WeaponPlayer
        {
            return this._weaponPlayer;
        }// end function

        override protected function hasNextPoint() : Boolean
        {
            return super.hasNextPoint();
        }// end function

        protected function updateRealPoint() : void
        {
            var _loc_1:AstarTurnPoint = null;
            if (_pathArray.length > 2)
            {
                _loc_1 = _pathArray[_pathArray.length - 2];
                setRealPoint(_loc_1._x, _loc_1._y);
            }
            else if (_nextPoint)
            {
                setRealPoint(_nextPoint._x, _nextPoint._y);
            }
            else
            {
                setRealPoint(this.x2d, this.y2d);
            }
            return;
        }// end function

        override protected function walkEnd() : void
        {
            super.walkEnd();
            setRealPoint(this.x2d, this.y2d);
            return;
        }// end function

        override public function walking(param1:Array) : void
        {
            super.walking(param1);
            this.updateRealPoint();
            return;
        }// end function

        override public function diversion(param1:Array) : void
        {
            super.diversion(param1);
            this.updateRealPoint();
            return;
        }// end function

        override protected function initPlayers() : void
        {
            super.initPlayers();
            if (!this._weaponPlayer || this._weaponPlayer.user != this)
            {
                this._weaponPlayer = FrObjectPool.getObject(WeaponPlayer, this);
                this._weaponPlayer.hangBoneName = BoneConst.ModelHangWeaponBone;
                _playerList.push(this._weaponPlayer);
            }
            if (!this._hairPlayer)
            {
                this._hairPlayer = FrObjectPool.getObject(ActionPlayer, this);
                this._hairPlayer.changeAction(ActionName.Stand);
                this._hairPlayer.hangBoneName = BoneConst.ModelHangHairBone;
                this._hairPlayer.selectEnabled = false;
                this._hairPlayer.enabeldDrawDefault = false;
                this._hairPlayer.timerContorler = this.timerContorler;
                this._hairPlayer.play();
                _playerList.push(this._hairPlayer);
            }
            return;
        }// end function

        override protected function updateActionName() : void
        {
            if (_actionType == ActionType.Walking)
            {
                if (entityInfo.isTurned)
                {
                    refreshActionName(ActionName.Walking);
                }
                else if (_inMount)
                {
                    refreshActionName(ActionName.RoleMountWalk);
                    if (this._mountPlayer)
                    {
                        this._mountPlayer.changeAction(ActionName.MountWalk);
                        this._mountPlayer.play();
                    }
                }
                else if (entityInfo.isInFly)
                {
                    refreshActionName(ActionName.Fly);
                    if (this._wingPlayer)
                    {
                        this._wingPlayer.changeAction(ActionName.Fly);
                    }
                }
                else if (_isInSwinArea)
                {
                    refreshActionName(ActionName.Swim);
                    this.udpateSwinEffect(1);
                }
                else if (sentityInfo.fighting)
                {
                    refreshActionName(ActionName.FightRun);
                }
                else
                {
                    refreshActionName(ActionName.Walking);
                }
            }
            if (_actionType == ActionType.Stand)
            {
                if (entityInfo.isTurned)
                {
                    refreshActionName(ActionName.Stand);
                }
                else if (_inMount && this._mountPlayer)
                {
                    refreshActionName(ActionName.RoleMountStand);
                    this._mountPlayer.changeAction(ActionName.MountStand);
                    this._mountPlayer.play();
                }
                else if (entityInfo.isInFly)
                {
                    refreshActionName(ActionName.FlyStand);
                    if (this._wingPlayer)
                    {
                        this._wingPlayer.changeAction(ActionName.FlyStand);
                    }
                }
                else if (_isInSwinArea)
                {
                    refreshActionName(ActionName.SwimStand);
                    this.udpateSwinEffect(0);
                }
                else if (sentityInfo.fighting)
                {
                    refreshActionName(ActionName.FightWait);
                }
                else
                {
                    refreshActionName(ActionName.Stand);
                }
            }
            this.updateBodyDirection();
            return;
        }// end function

        override protected function refreshActionNameCompl() : void
        {
            super.refreshActionNameCompl();
            if (this._hairPlayer)
            {
                this._hairPlayer.changeAction(_actionName);
                this._hairPlayer.play();
            }
            if (this._wingPlayer)
            {
                if (_actionType == ActionType.Walking)
                {
                    if (entityInfo.isInFly)
                    {
                        this._wingPlayer.changeAction(ActionName.Fly);
                    }
                    else
                    {
                        this._wingPlayer.changeAction(ActionName.Walking);
                    }
                }
                else if (entityInfo.isInFly)
                {
                    this._wingPlayer.changeAction(ActionName.FlyStand);
                }
                else
                {
                    this._wingPlayer.changeAction(ActionName.Stand);
                }
                this._wingPlayer.play();
            }
            return;
        }// end function

        override protected function updateBodyDirection() : void
        {
            if (_inMount)
            {
                if (this._mountPlayer)
                {
                    this._mountPlayer.direction = super._direction;
                }
                _bodyPlayer.direction = 90;
            }
            else
            {
                super.updateBodyDirection();
            }
            return;
        }// end function

        override public function get type() : int
        {
            return EEntityType._EEntityTypePlayer;
        }// end function

        override public function updateCCS(param1:SEntityInfo, param2:Boolean = false) : void
        {
            super.updateCCS(param1, param2);
            this.updateClothes(_entityInfo.clothes);
            this.updateHair(_entityInfo.hair);
            this.updateWeapons(_entityInfo.weapon);
            if (career == ECareer._ECareerPriest)
            {
                hoverLeft = 40;
                hoverTop = 100;
                hoverWidth = 80;
                hoverHeight = 120;
            }
            else
            {
                hoverLeft = 50;
                hoverTop = 140;
                hoverWidth = 100;
                hoverHeight = 160;
            }
            return;
        }// end function

        override public function updateWeapons(param1:int) : void
        {
            var _loc_4:int = 0;
            if (entityInfo.isTurned && param1 > 0)
            {
                return;
            }
            var _loc_2:* = param1;
            var _loc_3:* = this.getModelInfo(ModelType.WEAPONS, _loc_2);
            if (_loc_3)
            {
                this._weaponPlayer.load(_loc_3.mesh + ".md5mesh", _loc_3.texture, getRenderList());
                this.setPlayerModel(EEntityAttribute._EAttributeWeapon, _loc_3.mesh + ".md5mesh", _loc_3.texture);
                _bodyPlayer.hang(this._weaponPlayer);
                this.addToPlayerList(this._weaponPlayer);
                if (this._weaponHangEffect)
                {
                    this._weaponHangEffect.dispose();
                    this._weaponHangEffect = null;
                }
                if (_loc_3.selfEffect && (entityInfo.isWeaponItem || VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypeWeaponEffect, entityInfo.entityInfo.VIP)))
                {
                    this._weaponHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_3.selfEffect, this._weaponPlayer, null, true);
                    this.setEffect(this._weaponHangEffect);
                    if (this._weaponHangEffect.temple is TempleRole)
                    {
                        (this._weaponHangEffect.temple as TempleRole).setRoleParams(this._weaponPlayer, null, null);
                    }
                    this._weaponHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            else
            {
                if (this._weaponHangEffect)
                {
                    this._weaponHangEffect.dispose();
                }
                _bodyPlayer.unHang(this._weaponPlayer);
                this.removeChild(this._weaponPlayer);
                this.removeFromPlayerList(this._weaponPlayer);
            }
            return;
        }// end function

        protected function removeFromPlayerList(param1:Mesh3D) : void
        {
            var _loc_2:* = _playerList.indexOf(param1);
            if (_loc_2 >= 0)
            {
                _playerList.splice(_loc_2, 1);
                param1.renderList = Global3D.scene.renderLayerList;
            }
            return;
        }// end function

        protected function addToPlayerList(param1:Mesh3D) : void
        {
            var _loc_2:* = _playerList.indexOf(param1);
            if (_loc_2 < 0)
            {
                _playerList.push(param1);
                if (_entityInfo.isInFly)
                {
                    param1.renderList = LastRender.instance.renderList;
                }
                else
                {
                    param1.renderList = Global3D.scene.renderLayerList;
                }
            }
            return;
        }// end function

        override public function updateModel() : void
        {
            var _loc_1:TBoss = null;
            if (this.isInSwinArea)
            {
                if (this.actionType != ActionType.Sunbath && this.actionType != ActionType.Walking && this.actionType != ActionType.Stand)
                {
                    if (this.isMove)
                    {
                        setAction(ActionType.Walking, ActionName.Walking);
                    }
                    else
                    {
                        setAction(ActionType.Stand, ActionName.Stand);
                    }
                }
                this.updateMount(0);
                this.updateWeapons(0);
                this.updateHair(0);
                this.updateWizard(0);
                this.updateWing(0);
                this.updateClothes(this.swinCloth);
            }
            else if (entityInfo.isTurned)
            {
                this.updateMount(0);
                this.updateWeapons(0);
                this.updateHair(0);
                this.updateWizard(0);
                this.updateWing(0);
                _loc_1 = BossConfig.instance.getInfoByCode(entityInfo.turnModel);
                if (_loc_1)
                {
                    if (this._clothHangEffect)
                    {
                        this._clothHangEffect.dispose();
                        this._clothHangEffect = null;
                    }
                    refreshActionType(ActionType.Stand);
                    refreshActionName(ActionName.Stand);
                    _bodyPlayer.load(_loc_1.mesh + ".md5mesh", _loc_1.bone + ".skeleton", _loc_1.texture, getRenderList());
                }
            }
            else
            {
                this.updateClothes(_entityInfo.clothes);
                this.updateHair(_entityInfo.hair);
                this.updateWeapons(_entityInfo.weapon);
                this.updateMount(sentityInfo.mountCode);
                this.updateWizard(sentityInfo.spriteCode);
                this.updateWing(_entityInfo.wing);
                this.modelScale = 1;
                _defaultScale = 1;
            }
            return;
        }// end function

        override public function updateClothes(param1:int) : void
        {
            var _loc_4:String = null;
            var _loc_5:String = null;
            var _loc_6:String = null;
            if (entityInfo.isTurned)
            {
                return;
            }
            var _loc_2:* = param1;
            var _loc_3:* = this.getModelInfo(ModelType.CLOTHES, _loc_2);
            if (_loc_3 && (_bodyPlayer.meshUrl != _loc_3.mesh + ".md5mesh" || _bodyPlayer.animUrl != _loc_3.bone + ".skeleton"))
            {
                _loc_4 = _loc_3.mesh + ".md5mesh";
                _loc_5 = _loc_3.bone + ".skeleton";
                _loc_6 = _loc_3.texture;
                if (entityInfo.isSpecialClothes() && _actionType != ActionType.Sunbath && _actionType != ActionType.Wine || entityInfo.isUpdateSpecialClothes)
                {
                    setAction(ActionType.Stand, ActionName.Stand, true);
                }
                _bodyPlayer.load(_loc_4, _loc_5, _loc_6, getRenderList());
                this.setPlayerModel(EEntityAttribute._EAttributeClothes, _loc_4, _loc_5, _loc_6);
                if (this._clothHangEffect)
                {
                    this._clothHangEffect.dispose();
                    this._clothHangEffect = null;
                }
                if (_loc_3.selfEffect && (entityInfo.isClothesItem || VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypeClothesEffect, entityInfo.entityInfo.VIP)))
                {
                    this._clothHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_3.selfEffect, _bodyPlayer, null, true);
                    this.setEffect(this._clothHangEffect);
                    if (this._clothHangEffect.temple is TempleRole)
                    {
                        (this._clothHangEffect.temple as TempleRole).setRoleParams(_bodyPlayer, null, null);
                    }
                    this._clothHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            return;
        }// end function

        protected function setPlayerModel(param1:int, ... args) : void
        {
            return;
        }// end function

        protected function setEffect(param1:EffectPlayer) : void
        {
            return;
        }// end function

        public function set openShadow(param1:Boolean) : void
        {
            var _loc_2:Mesh3D = null;
            for each (_loc_2 in _playerList)
            {
                
                if (_loc_2 is ActionPlayer)
                {
                    (_loc_2 as ActionPlayer).openShadow = param1;
                }
            }
            return;
        }// end function

        override public function updateHair(param1:int) : void
        {
            if (entityInfo.isTurned || param1 == -1)
            {
                _bodyPlayer.unHang(this._hairPlayer);
                this.removeFromPlayerList(this._hairPlayer);
                return;
            }
            this.addToPlayerList(this._hairPlayer);
            _bodyPlayer.hang(this._hairPlayer);
            var _loc_2:* = this.getModelInfo(ModelType.HAIR, param1);
            if (_loc_2)
            {
                this._hairPlayer.load(_loc_2.mesh + ".md5mesh", _loc_2.bone + ".skeleton", _loc_2.texture, getRenderList());
                this.setPlayerModel(EEntityAttribute._EAttributeFashionHeadwear, _loc_2.mesh + ".md5mesh", _loc_2.bone + ".skeleton", _loc_2.texture);
            }
            return;
        }// end function

        override protected function updateTitle() : void
        {
            var _loc_1:* = _entityInfo.entityInfo.titleId;
            if (GameMapUtil.curMapState.isWineMap && !TitleUtil.isWinePartyTitle(_loc_1))
            {
                _loc_1 = 0;
            }
            var _loc_2:* = TitleConfig.instance.getInfoById(_loc_1);
            var _loc_3:Array = [];
            if (_loc_2 && _loc_2.proxyId)
            {
                _loc_3 = _loc_2.proxyId.split("#");
                if (_loc_3.indexOf(Cache.instance.role.entityInfo.entityId.typeEx2.toString()) == -1)
                {
                    _loc_1 = 0;
                }
            }
            _headContainner.updateTitle(_loc_1);
            return;
        }// end function

        override public function updateLife(param1:int, param2:int, param3:Boolean = false) : void
        {
            if (!GameMapUtil.curMapState.isWineMap)
            {
                super.updateLife(param1, param2);
            }
            if (param1 <= 0)
            {
                this.isDead = true;
                if (!param3)
                {
                }
            }
            if (this.isDead)
            {
                if (param1 > 0)
                {
                    this.isDead = false;
                }
            }
            return;
        }// end function

        override public function updateWineLife(param1:int) : void
        {
            var _loc_2:int = 0;
            if (GameMapUtil.curMapState.isWineMap)
            {
                _loc_2 = GameConst.TGuildWinePersonAlcohol;
                _headContainner.updateLife(_entityInfo.reserveJs.pal, _loc_2, this.getBloodType());
                _headContainner.updateWineLife(Language.getStringByParam(20671, param1, _loc_2));
                _headContainner.disposeLevel3D();
            }
            return;
        }// end function

        public function removeWineLife() : void
        {
            _headContainner.disposeWineLifeText();
            return;
        }// end function

        override protected function getBloodType() : int
        {
            if (GameMapUtil.curMapState.isWineMap)
            {
                return EBloodType.PhysicalPower;
            }
            if (EntityRelationUtil.isFriend(entityInfo.entityInfo))
            {
                return EBloodType.Role;
            }
            return EBloodType.OtherPlayer;
        }// end function

        protected function getModelInfo(param1:int, param2:int) : TPlayerModel
        {
            return PlayerModelConfig.instance.getModelInfo(param1, param2, sex, career);
        }// end function

        override public function updateMount(param1:int) : void
        {
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:TModel = null;
            var _loc_5:ItemInfo = null;
            var _loc_6:TMountConfig = null;
            if (entityInfo && entityInfo.isTurned && param1 > 0)
            {
                return;
            }
            if (param1)
            {
                _inMount = true;
                if (!this._mountPlayer || this._mountPlayer.user != this)
                {
                    this._mountPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    this._mountPlayer.changeAction(ActionName.MountStand);
                    this._mountPlayer.timerContorler = this.timerContorler;
                    FrEventDispatcher.instance.proxyAddEventListener(this._mountPlayer, Engine3dEventName.InitComplete, this.onInitMountPlayer);
                }
                this._mountPlayer.openShadow = this._bodyPlayer.openShadow;
                this.addToPlayerList(this._mountPlayer);
                this._mountPlayer.play();
                this.addChild(this._mountPlayer);
                this._mountPlayer.hang(_bodyPlayer);
                if (param1 > 100)
                {
                    _loc_3 = param1;
                    _loc_5 = ItemConfig.instance.getConfig(_loc_3);
                    if (_loc_5 && _loc_5 is ItemEquipInfo)
                    {
                        _loc_3 = (_loc_5 as ItemEquipInfo).modelId;
                    }
                }
                else
                {
                    _loc_6 = MountConfig.instance.getMountInfoByCode(param1) as TMountConfig;
                    _loc_3 = _loc_6.modelId;
                }
                _loc_4 = ModelConfig.instance.getInfoByCode(_loc_3);
                if (_loc_4)
                {
                    this._mountPlayer.load(_loc_4.mesh1 + ".md5mesh", _loc_4.bone1 + ".skeleton", _loc_4.texture1, getRenderList());
                    this.setPlayerModel(EEntityAttribute._EAttributeMount, _loc_4.mesh1 + ".md5mesh", _loc_4.bone1 + ".skeleton", _loc_4.texture1);
                    if (this._mountHangEffect)
                    {
                        this._mountHangEffect.dispose();
                        this._mountHangEffect = null;
                    }
                    if (_loc_4.effect1 && (param1 > 100 || VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypeMountEffect, entityInfo.entityInfo.VIP)))
                    {
                        this._mountHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_4.effect1, this._mountPlayer, null, true);
                        this.setEffect(this._mountHangEffect);
                        if (this._mountHangEffect.temple is TempleRole)
                        {
                            (this._mountHangEffect.temple as TempleRole).setRoleParams(this._mountPlayer, null, null);
                        }
                        this._mountHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                    }
                }
            }
            else
            {
                _inMount = false;
                if (this._mountPlayer && this.contains(this._mountPlayer))
                {
                    if (this._mountHangEffect)
                    {
                        this._mountHangEffect.dispose();
                    }
                    this.removeFromPlayerList(this._mountPlayer);
                    this.removeChild(this._mountPlayer);
                    this._mountPlayer.unHang(_bodyPlayer);
                    this.addChild(_bodyPlayer);
                }
            }
            this.updateActionName();
            return;
        }// end function

        protected function onInitMountPlayer(event:Event) : void
        {
            this.updateNamePosition();
            return;
        }// end function

        public function killFlyTween() : void
        {
            if (this._tweenY)
            {
                this._tweenY.kill();
                this._tweenY = null;
            }
            return;
        }// end function

        override protected function updateFly(param1:Boolean, param2:Boolean) : void
        {
            this.setFlyRender(param1);
            this.killFlyTween();
            if (param2)
            {
                if (param1)
                {
                    this.y = 200;
                    this.scaleX = 1.5;
                    this.scaleY = 1.5;
                    this.scaleZ = 1.5;
                }
                else
                {
                    this.y = 0;
                    this.scaleX = 1;
                    this.scaleY = 1;
                    this.scaleZ = 1;
                }
            }
            else
            {
                this.tweenFlyY(param1);
            }
            this.updateActionName();
            this.updateWizardVisible();
            return;
        }// end function

        protected function tweenFlyY(param1:Boolean) : void
        {
            var _loc_2:* = SceneRange.display.height / 620;
            if (param1)
            {
                this._tweenY = TweenLite.to(this, 2, {y:200 * _loc_2, scaleX:1.5, scaleY:1.5, scaleZ:1.5});
            }
            else
            {
                this._tweenY = TweenLite.to(this, 2, {y:0, scaleX:1, scaleY:1, scaleZ:1});
            }
            return;
        }// end function

        override public function updateToast(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Wine, ActionName.toast);
            }
            else if (_actionName == ActionName.toast)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override public function updateDrunk(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Wine, ActionName.drunk);
            }
            else if (_actionName == ActionName.drunk)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override public function updateMoraReady(param1:Boolean) : void
        {
            return;
        }// end function

        override public function updateMoraBeauty(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Wine, ActionName.moraBeauty);
            }
            else if (_actionName == ActionName.moraBeauty)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override public function updateMoraThief(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Wine, ActionName.moraThief);
            }
            else if (_actionName == ActionName.moraThief)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override public function updateMoraPolice(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Wine, ActionName.moraPolice);
            }
            else if (_actionName == ActionName.moraPolice)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override protected function updateWines() : void
        {
            if (GameMapUtil.curMapState.isWineMap)
            {
                _headContainner.updateWineIcons(_entityInfo.wineIndexs);
            }
            else
            {
                _headContainner.updateWineIcons([]);
            }
            return;
        }// end function

        override protected function updateTreasure() : void
        {
            _headContainner.updateTreasureIcon(_entityInfo.treasureIndex);
            return;
        }// end function

        override public function updateSun(param1:Boolean) : void
        {
            if (param1)
            {
                setAction(ActionType.Sunbath, ActionName.Sun);
            }
            else if (_actionName == ActionName.Sun)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        override public function updatePlayMusical(param1:Boolean) : void
        {
            var _loc_2:String = null;
            if (param1)
            {
                setAction(ActionType.Sunbath, ActionName.PlayMusical);
                if (!this._sunbathCopyPlayMusical)
                {
                    _loc_2 = this.sex == ESex._ESexMan ? ("tiaowu-nan-1-tiaowu") : ("tiaowu-nv-1-tiaowu");
                    this._sunbathCopyPlayMusical = EffectPlayerPool.instance.getEffectPlayer(_loc_2, _bodyPlayer, null, true);
                    if (this._sunbathCopyPlayMusical.temple is TempleRole)
                    {
                        (this._sunbathCopyPlayMusical.temple as TempleRole).setRoleParams(_bodyPlayer, null, null);
                    }
                    else
                    {
                        _bodyPlayer.hang(this._sunbathCopyPlayMusical);
                    }
                    this._sunbathCopyPlayMusical.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            else
            {
                if (_actionName == ActionName.PlayMusical)
                {
                    setAction(ActionType.Stand, ActionName.Stand);
                }
                if (this._sunbathCopyPlayMusical)
                {
                    this._sunbathCopyPlayMusical.dispose();
                    this._sunbathCopyPlayMusical = null;
                }
            }
            return;
        }// end function

        override public function updateDance(param1:Boolean) : void
        {
            var _loc_2:Array = null;
            if (param1)
            {
                _loc_2 = ThingUtil.entityUtil.danceInfo;
                setAction(ActionType.Sunbath, ActionName.Dance);
                if (_loc_2)
                {
                    _bodyPlayer.direction = _loc_2[1];
                    _bodyPlayer.gotoFrame(_loc_2[0]);
                }
            }
            else if (_actionName == ActionName.Dance)
            {
                setAction(ActionType.Stand, ActionName.Stand);
            }
            return;
        }// end function

        public function get danceInfo() : Array
        {
            if (_bodyPlayer)
            {
                return [_bodyPlayer.currentFrame, _bodyPlayer.direction];
            }
            return null;
        }// end function

        override public function updateZazen(param1:Boolean) : void
        {
            var _loc_2:String = null;
            if (param1)
            {
                if (_isMove)
                {
                    this.stopWalking();
                }
                setAction(ActionType.Sit, ActionName.Sit);
                if (!this._zazenEffectPlayer)
                {
                    _loc_2 = this.sex == ESex._ESexMan ? ("mingxiang-nan") : ("mingxiang-nv");
                    this._zazenEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_2, _bodyPlayer, null, true, true);
                    if (this._zazenEffectPlayer.temple is TempleRole)
                    {
                        (this._zazenEffectPlayer.temple as TempleRole).setRoleParams(_bodyPlayer, null, null);
                    }
                    else
                    {
                        _bodyPlayer.hang(this._zazenEffectPlayer);
                    }
                    this._zazenEffectPlayer.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            else if (!entityInfo.isInZazen)
            {
                if (_actionName == ActionName.Sit)
                {
                    setAction(ActionType.Stand, ActionName.Stand);
                }
                if (this._zazenEffectPlayer)
                {
                    this._zazenEffectPlayer.dispose();
                    this._zazenEffectPlayer = null;
                }
            }
            return;
        }// end function

        override public function updateDoubleZazen(param1:Boolean) : void
        {
            var _loc_2:SpritePlayer = null;
            if (param1)
            {
                this.updateZazen(true);
                if (entityInfo.zazenEntityId)
                {
                    _loc_2 = ThingUtil.entityUtil.getEntity(entityInfo.zazenEntityId) as SpritePlayer;
                    if (_loc_2)
                    {
                        this.direction = GameMapUtil.getDirectionByXY(this.x2d, this.y2d, _loc_2.x2d, _loc_2.y2d);
                    }
                }
            }
            else
            {
                this.updateZazen(false);
            }
            return;
        }// end function

        override public function set isDead(param1:Boolean) : void
        {
            super.isDead = param1;
            return;
        }// end function

        override protected function isDeadChange() : void
        {
            if (_isDead)
            {
                setAction(ActionType.Death, ActionName.Death);
                stopWalking();
            }
            else
            {
                setAction(ActionType.Stand, ActionName.Stand);
                _bodyPlayer.play();
            }
            return;
        }// end function

        override public function updateName(param1:String = null, param2:Boolean = true) : void
        {
            var _loc_3:String = "";
            if (GameMapUtil.curMapState.isEscortCopy && this is RolePlayer == false)
            {
                _loc_3 = NameUtil.getNameInEscortCopy(this.entityInfo);
            }
            else
            {
                _loc_3 = NameUtil.getName(entityInfo, param1);
            }
            if (GameMapUtil.curMapState.isTreasureHunt && entityInfo.treasureHuntRoleName)
            {
                _loc_3 = entityInfo.treasureHuntRoleName;
            }
            entityInfo.updateIsEnemy();
            _headContainner.updateName(_loc_3);
            return;
        }// end function

        override public function updateProxyVIP() : void
        {
            if (PlatformConst.isQQ())
            {
                _headContainner.updateQQHuangzhuan(ParamsConst.instance.enterType, entityInfo.reserveJs.proxyLv, entityInfo.reserveJs.isYearProxyVIP, entityInfo.reserveJs.isProxyVIPOut, entityInfo.reserveJs.isProxyVIPSuper);
            }
            return;
        }// end function

        override protected function updateGuildName() : void
        {
            var _loc_1:* = entityInfo.reserveJs.guild_war_guild_name;
            var _loc_2:* = _loc_1 || sentityInfo.guildId.id > 0;
            var _loc_3:String = "";
            if (_loc_2)
            {
                if (_loc_1)
                {
                    _loc_3 = Language.getStringByParam(20672, _loc_1 + NameUtil.Spacer);
                }
                else
                {
                    _loc_3 = sentityInfo.guildName + NameUtil.Spacer + GameDefConfig.instance.getGuildPositonName(sentityInfo.guildPosition);
                }
            }
            _headContainner.updateGuildName(_loc_3);
            return;
        }// end function

        override protected function updateNamePosition() : void
        {
            if (!_inMount)
            {
                _headContainner.y = _bodyPlayer.getBoneGlobleY(_headContainner.hangBoneName) + 20;
            }
            else
            {
                _headContainner.y = -45 + _bodyPlayer.getBoneGlobleY(_headContainner.hangBoneName, this._mountPlayer, ActionName.MountStand, BoneConst.MountHangModelBone);
            }
            return;
        }// end function

        override protected function updateOther(param1:SEntityInfo, param2:Boolean = true) : void
        {
            super.updateOther(param1, param2);
            this.setEntityIDByType(this._petEntityID, EEntityType._EEntityTypePet);
            return;
        }// end function

        private function setEntityIDByType(param1:SEntityId, param2:int) : void
        {
            if (entityInfo && entityInfo.entityInfo)
            {
                param1.id = entityInfo.entityInfo.entityId.id;
                param1.typeEx = entityInfo.entityInfo.entityId.typeEx;
                param1.typeEx2 = entityInfo.entityInfo.entityId.typeEx2;
                param1.type = param2;
            }
            return;
        }// end function

        public function getSelfPet() : PetPlayer
        {
            return ThingUtil.entityUtil.getEntity(this._petEntityID) as PetPlayer;
        }// end function

        override public function updateWizard(param1:int) : void
        {
            if (param1 > 0)
            {
                if (!this._wizardSmallPlayer)
                {
                    this._wizardSmallPlayer = FrObjectPool.getObject(WizardSmallPlayer, this);
                    this._wizardSmallPlayer.changeAction(ActionName.Walking);
                    this._wizardSmallPlayer.selectEnabled = false;
                    this._wizardSmallPlayer.enabeldDrawDefault = false;
                    this._wizardSmallPlayer.play();
                }
                this._wizardSmallPlayer.addToUser(this, param1);
            }
            else if (this._wizardSmallPlayer)
            {
                this._wizardSmallPlayer.dispose();
                this._wizardSmallPlayer = null;
            }
            return;
        }// end function

        override public function updateWing(param1:int) : void
        {
            var _loc_2:TPlayerModel = null;
            if (entityInfo.isTurned)
            {
                if (this._wingPlayer)
                {
                    _bodyPlayer.unHang(this._wingPlayer);
                    this.removeFromPlayerList(this._wingPlayer);
                }
                return;
            }
            if (param1 > 0 && !_entityInfo.isHideWing)
            {
                if (!this._wingPlayer || this._wingPlayer.user != this)
                {
                    this._wingPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    this._wingPlayer.changeAction(ActionName.Stand);
                    this._wingPlayer.hangBoneName = BoneConst.ModelHangWingBone;
                    this._wingPlayer.selectEnabled = false;
                    this._wingPlayer.enabeldDrawDefault = false;
                    this._wingPlayer.timerContorler = this.timerContorler;
                    this._wingPlayer.play();
                }
                _bodyPlayer.hang(this._wingPlayer);
                this._wingPlayer.openShadow = this._bodyPlayer.openShadow;
                this.addToPlayerList(this._wingPlayer);
                _loc_2 = this.getModelInfo(ModelType.WING, param1);
                if (_loc_2)
                {
                    this._wingPlayer.load(_loc_2.mesh + ".md5mesh", _loc_2.bone + ".skeleton", _loc_2.texture, getRenderList(), 0.5, EBlendType.BLEND_ALPHA0);
                    this.setPlayerModel(EEntityAttribute._EAttributeFashionWing, _loc_2.mesh + ".md5mesh", _loc_2.bone + ".skeleton", _loc_2.texture);
                }
                if (this._wingHangEffect)
                {
                    this._wingHangEffect.dispose();
                    this._wingHangEffect = null;
                }
                if (_loc_2.selfEffect && (entityInfo.isWingItem || VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypeWingEffect, entityInfo.entityInfo.VIP)))
                {
                    this._wingHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_2.selfEffect, this._wingPlayer, null, true);
                    this.setEffect(this._wingHangEffect);
                    if (this._wingHangEffect.temple is TempleRole)
                    {
                        (this._wingHangEffect.temple as TempleRole).setRoleParams(this._wingPlayer, null, null);
                    }
                    this._wingHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            else if (this._wingPlayer)
            {
                if (this._wingHangEffect)
                {
                    this._wingHangEffect.dispose();
                    this._wingHangEffect = null;
                }
                _bodyPlayer.unHang(this._wingPlayer);
                this.removeFromPlayerList(this._wingPlayer);
                this._wingPlayer.dispose();
                this._wingPlayer = null;
            }
            return;
        }// end function

        override protected function enterSwinArea() : void
        {
            this.updateModel();
            super.enterSwinArea();
            return;
        }// end function

        override protected function leaveSwinArea() : void
        {
            this.updateModel();
            super.leaveSwinArea();
            this.removeSiwnEffect();
            return;
        }// end function

        protected function udpateSwinEffect(param1:int) : void
        {
            var _loc_2:String = "youyong-1";
            if (param1 == 0)
            {
                _loc_2 = "youyong-2";
            }
            if (this._currentUrl != _loc_2)
            {
                this._currentUrl = _loc_2;
                if (this._swinEffect)
                {
                    this._swinEffect.dispose();
                    this._swinEffect = null;
                }
                this._swinEffect = SkillEffectUtil.addPlayerEffect(this, _loc_2, false, false, null, PlayMode.ANIMATION_LOOP_MODE);
            }
            return;
        }// end function

        protected function removeSiwnEffect() : void
        {
            this._currentUrl = "";
            if (this._swinEffect)
            {
                this._swinEffect.dispose();
                this._swinEffect = null;
            }
            return;
        }// end function

        override protected function updateMainCityFlag() : void
        {
            if (_entityInfo && _entityInfo.reserveJs.maincity_flag)
            {
                if (!this._mainCityPlayer)
                {
                    this._mainCityPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    this._mainCityPlayer.changeAction(ActionName.Stand);
                    this._mainCityPlayer.hangBoneName = BoneConst.ModelHangWingBone;
                    this._mainCityPlayer.selectEnabled = false;
                    this._mainCityPlayer.enabeldDrawDefault = false;
                    this._mainCityPlayer.timerContorler = this.timerContorler;
                    this._mainCityPlayer.play();
                }
                _bodyPlayer.hang(this._mainCityPlayer);
                this._mainCityPlayer.openShadow = this._bodyPlayer.openShadow;
                this.addToPlayerList(this._mainCityPlayer);
                this._mainCityPlayer.load("dczq.md5mesh", "dczq.skeleton", "dczq.abc", getRenderList(), 0.5, EBlendType.BLEND_ALPHA0);
                if (this._mainCityEffectPlayer)
                {
                    this._mainCityEffectPlayer.dispose();
                    this._mainCityEffectPlayer = null;
                }
                this._mainCityEffectPlayer = EffectPlayerPool.instance.getEffectPlayer("zhanqi-5", this._wingPlayer, null, true);
                if (this._mainCityEffectPlayer.temple is TempleRole)
                {
                    (this._mainCityEffectPlayer.temple as TempleRole).setRoleParams(this._mainCityPlayer, null, null);
                }
                this._mainCityEffectPlayer.play(PlayMode.ANIMATION_LOOP_MODE);
            }
            else if (this._mainCityPlayer)
            {
                if (this._mainCityEffectPlayer)
                {
                    this._mainCityEffectPlayer.dispose();
                    this._mainCityEffectPlayer = null;
                }
                _bodyPlayer.unHang(this._mainCityPlayer);
                this.removeFromPlayerList(this._mainCityPlayer);
                this._mainCityPlayer.dispose();
                this._mainCityPlayer = null;
            }
            return;
        }// end function

        override public function addToStage(param1:SLayer3D) : Boolean
        {
            if (this._wizardSmallPlayer)
            {
                if (ThingUtil.entityUtil.isWizardShow && !GameMapUtil.isInHideSpriteMap)
                {
                    this._wizardSmallPlayer.addToStage();
                }
                else
                {
                    this._wizardSmallPlayer.removeFromStage();
                }
            }
            return super.addToStage(param1);
        }// end function

        override public function removeFromStage(param1:SLayer3D, param2:Boolean = false) : Boolean
        {
            if (this.parent == param1 && this._wizardSmallPlayer)
            {
                this._wizardSmallPlayer.removeFromStage();
            }
            return super.removeFromStage(param1, param2);
        }// end function

        public function updateWizardVisible() : void
        {
            if (this._wizardSmallPlayer)
            {
                if (Game.scene.playerLayer.contains(this) && !GameMapUtil.isInHideSpriteMap && ThingUtil.entityUtil.isWizardShow && !entityInfo.isInFly)
                {
                    this._wizardSmallPlayer.addToStage();
                }
                else
                {
                    this._wizardSmallPlayer.removeFromStage();
                }
            }
            return;
        }// end function

        override public function updateHeadContainer() : void
        {
            super.updateHeadContainer();
            var _loc_1:* = entityInfo.isInLayer;
            var _loc_2:* = this.selected;
            var _loc_3:* = SystemSetting.instance.isHideOterPlayerName.bValue;
            _headContainner.updateNameVisible(_loc_1 && !GameMapUtil.isInHideNameMap && !entityInfo.isInHidden && !entityInfo.isHide && (!_loc_3 || _loc_2 || this.entityInfo.isAttackRole));
            return;
        }// end function

        public function setFlyRender(param1:Boolean) : void
        {
            var _loc_2:Mesh3D = null;
            for each (_loc_2 in _playerList)
            {
                
                if (param1)
                {
                    _loc_2.renderList = LastRender.instance.renderList;
                    continue;
                }
                _loc_2.renderList = Global3D.scene.renderLayerList;
            }
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            this.setFlyRender(false);
            this.killFlyTween();
            this.removeSiwnEffect();
            if (this._mainCityEffectPlayer)
            {
                this._mainCityEffectPlayer.dispose();
                this._mainCityEffectPlayer = null;
            }
            if (this._mainCityPlayer)
            {
                _bodyPlayer.unHang(this._mainCityPlayer);
                this.removeFromPlayerList(this._mainCityPlayer);
                this._mainCityPlayer.dispose();
                this._mainCityPlayer = null;
            }
            if (this._zazenEffectPlayer)
            {
                this._zazenEffectPlayer.dispose();
                this._zazenEffectPlayer = null;
            }
            if (this._sunbathCopyPlayMusical)
            {
                this._sunbathCopyPlayMusical.dispose();
                this._sunbathCopyPlayMusical = null;
            }
            if (this._wizardSmallPlayer)
            {
                this._wizardSmallPlayer.dispose();
                this._wizardSmallPlayer = null;
            }
            if (this._clothHangEffect)
            {
                this._clothHangEffect.dispose();
                this._clothHangEffect = null;
            }
            if (this._wingHangEffect)
            {
                this._wingHangEffect.dispose();
                this._wingHangEffect = null;
            }
            if (this._wingPlayer)
            {
                this._wingPlayer.dispose();
                this._wingPlayer = null;
            }
            if (this._weaponHangEffect)
            {
                this._weaponHangEffect.dispose();
                this._weaponHangEffect = null;
            }
            if (this._weaponPlayer)
            {
                this._weaponPlayer.dispose();
                this._weaponPlayer = null;
            }
            if (this._mountHangEffect)
            {
                this._mountHangEffect.dispose();
                this._mountHangEffect = null;
            }
            if (this._mountPlayer)
            {
                FrEventDispatcher.instance.proxyRemoveEventListener(this._mountPlayer, Engine3dEventName.InitComplete, this.onInitMountPlayer);
                this._mountPlayer.unHang(_bodyPlayer);
                this._mountPlayer.dispose();
                this._mountPlayer = null;
            }
            if (this._hairPlayer)
            {
                _bodyPlayer.unHang(this._hairPlayer);
                this._hairPlayer.dispose();
                this._hairPlayer = null;
            }
            super.dispose(param1);
            return;
        }// end function

    }
}
